   function toCustomerField(cataLog,fieldHandler)
     {
       var url =base + "/customerFieldMain.do?cataLog="+cataLog+"&fieldHandler="+fieldHandler;
       jQuery.layer({
           type: 2,
           border: [0],
           title: false,
           shadeClose: true,
           closeBtn: true,
           iframe: {src : url},
           area: ['420px' , '520px'] 
          }); 
     }


function toaddDictCatalog()
{
	   var tr=jQuery("<tr>").css({height:"22px"});
       var div=jQuery("<div align='center' class='STYLE2 STYLE1'>");
       var td=jQuery("<td  bgcolor='#FFFFFF' class='STYLE2'>"); 
       var oper = jQuery(div).clone();
       jQuery(oper).html(
         '<span class="STYLE2">'+
         '<img src="'+cache+'/images/010.gif" width="9" height="9" /></span>&nbsp;<span class="STYLE1">'+ 
         '[&nbsp;</span><a href="javascript:void(0)">删除</a><span class="STYLE1">&nbsp;]'+
         '</span>');
        jQuery(oper).bind("click",function()
         {
        	deleteCatalog(this);
         });
        jQuery(td).clone().append(jQuery(div).clone().html(calcCustomerSeq())).appendTo(tr);
        jQuery(td).clone().append(jQuery(div).clone().html(
        '<input name="catalogName" style="text-transform : uppercase">')).appendTo(tr);
        jQuery(td).clone().append(jQuery(div).clone().html('<input name="catalogDesc" >')).appendTo(tr) ;
        jQuery(td).clone().append(jQuery(div).clone().html('')).appendTo(tr);
        jQuery(td).clone().append(oper).appendTo(tr);
        jQuery(tr).appendTo("#dictCatalogTb");
}


function deleteCatalog(th,status,id)
{
   if(status=="Y")
   {
     return alert("正在使用中，无法删除。");
   } 
   if(id)
   {
	   jQuery.post(
	              base+"/dictCatalogManager/delDictCatalog.do",
	              {id:id},
	              function(result){
	                  var d= eval("("+result+")");
	                  if(d.STATUS=="0")
	                   {
	                     alert("删除成功!");
	                     location.reload();
	                   }
	                  else
	                   {
	                      alert(d.MSG);
	                   }
	       });
   }
   else
   {
	   jQuery(th).parent().parent().remove();
	   assignCustomerDefSeq();
   }
}

function assignCustomerDefSeq()
{
   jQuery("#dictCatalogTb").children().each(
          function(index,obj)
          {
             jQuery(obj).find("div:eq(0)").html((index+1));
          }
    );
}


function saveDictCatalog()
{ 
    var arr = new Array();
    jQuery(":input[name='catalogName']").each(function(index,object)
     {
    	   if(!jQuery(object).val())
           {
    		    alert("请输入字典目录名称!");
    		    return jQuery(object).select();
           }
    	   var fvalue = jQuery(":input[name='catalogDesc']",jQuery(object).parent().parent().parent()).val();
           var catalogId =jQuery(object).attr("catalogId")||0;
           arr.push({name:jQuery(object).val(),value:fvalue,id:catalogId});
       }
    );
    if(arr!=null)
    {
       jQuery.post(
              base+"/dictCatalogManager/saveDictCatalog.do",
              {data:JSON.stringify(arr)},
              function(result){
                  var d= eval("("+result+")");
                  if(d.STATUS=="0")
                   {
                     alert("保存成功!");
                     location.reload();
                   }
                  else
                   {
                      alert(d.MSG);
                   }
       });
    }

}


function calcCustomerSeq()
{
     var len=jQuery("#dictCatalogTb").children().length;
     return (len+1);
}

